// 导入操作cookie的第三方包
import Cookies from 'js-cookie'

const TokenKey = 'vue_admin_template_token'
const LoginTimeKey = 'vue_admin_template_login_time'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  // 记录登陆时的时间戳
  Cookies.set(LoginTimeKey, Date.now())
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

export function getLoginTime() {
  return Cookies.get(LoginTimeKey)
}
